<?php

namespace App\Supports\Payment;

class Pay extends PayBase
{
	protected function perform($arguments)
	{
		if (count($arguments) > 0) {
			$argFirst = isset($arguments[0]) ? $arguments[0] : null;
			if (method_exists($this->method, 'find')) {
				return $this->method->find($argFirst);
			}
			if (method_exists($this->method, 'pay')) {
				return $this->method->pay($argFirst);
			}
			if (method_exists($this->method, 'refund')) {
				return $this->method->refund($argFirst);
			}
			if (method_exists($this->method, 'transfer')) {
				return $this->method->transfer($argFirst);
			}
			if (method_exists($this->method, 'callback')) {
				return $this->method->callback($argFirst);
			}
			if (method_exists($this->method, 'query')) {
				return $this->method->query($argFirst);
			}
		}
		return null;
	}
	
	public function __call($name, $arguments)
	{
		return $this->perform($arguments);
	}
}
